home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / xshogi11.lha / xshogi-1.1 / scanner.c < prev    next >
C/C++ Source or Header  |  1993-04-13  |  25KB  |  1,012 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* scanner skeleton version:
  4.  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. #include <stdio.h>
  10.  
  11.  
  12. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  13. #ifdef c_plusplus
  14. #ifndef __cplusplus
  15. #define __cplusplus
  16. #endif
  17. #endif
  18.  
  19.  
  20. #ifdef __cplusplus
  21.  
  22. #include <stdlib.h>
  23. #include <osfcn.h>
  24.  
  25. /* use prototypes in function declarations */
  26. #define YY_USE_PROTOS
  27.  
  28. /* the "const" storage-class-modifier is valid */
  29. #define YY_USE_CONST
  30.  
  31. #else    /* ! __cplusplus */
  32.  
  33. #ifdef __STDC__
  34.  
  35. #ifdef __GNUC__
  36. #include <stddef.h>
  37. void *malloc( size_t );
  38. void free( void* );
  39. #else
  40. #include <stdlib.h>
  41. #endif    /* __GNUC__ */
  42.  
  43. #define YY_USE_PROTOS
  44. #define YY_USE_CONST
  45.  
  46. #endif    /* __STDC__ */
  47. #endif    /* ! __cplusplus */
  48.  
  49.  
  50. #ifdef __TURBOC__
  51. #define YY_USE_CONST
  52. #endif
  53.  
  54.  
  55. #ifndef YY_USE_CONST
  56. #define const
  57. #endif
  58.  
  59.  
  60. #ifdef YY_USE_PROTOS
  61. #define YY_PROTO(proto) proto
  62. #else
  63. #define YY_PROTO(proto) ()
  64. /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
  65.  * so it's got to be a K&R compiler, and therefore there's no standard
  66.  * place from which to include these definitions
  67.  */
  68. char *malloc();
  69. int free();
  70. int read();
  71. #endif
  72.  
  73.  
  74. /* amount of stuff to slurp up with each read */
  75. #ifndef YY_READ_BUF_SIZE
  76. #define YY_READ_BUF_SIZE 8192
  77. #endif
  78.  
  79. /* returned upon end-of-file */
  80. #define YY_END_TOK 0
  81.  
  82. /* copy whatever the last rule matched to the standard output */
  83.  
  84. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  85. /* this used to be an fputs(), but since the string might contain NUL's,
  86.  * we now use fwrite()
  87.  */
  88. #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  89.  
  90. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  91.  * is returned in "result".
  92.  */
  93. #define YY_INPUT(buf,result,max_size) \
  94.     if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
  95.         YY_FATAL_ERROR( "read() in flex scanner failed" );
  96. #define YY_NULL 0
  97.  
  98. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  99.  * we don't want an extra ';' after the "return" because that will cause
  100.  * some compilers to complain about unreachable statements.
  101.  */
  102. #define yyterminate() return ( YY_NULL )
  103.  
  104. /* report a fatal error */
  105.  
  106. /* The funky do-while is used to turn this macro definition into
  107.  * a single C statement (which needs a semi-colon terminator).
  108.  * This avoids problems with code like:
  109.  *
  110.  *     if ( something_happens )
  111.  *        YY_FATAL_ERROR( "oops, the something happened" );
  112.  *    else
  113.  *        everything_okay();
  114.  *
  115.  * Prior to using the do-while the compiler would get upset at the
  116.  * "else" because it interpreted the "if" statement as being all
  117.  * done when it reached the ';' after the YY_FATAL_ERROR() call.
  118.  */
  119.  
  120. #define YY_FATAL_ERROR(msg) \
  121.     do \
  122.         { \
  123.         (void) fputs( msg, stderr ); \
  124.         (void) putc( '\n', stderr ); \
  125.         exit( 1 ); \
  126.         } \
  127.     while ( 0 )
  128.  
  129. /* default yywrap function - always treat EOF as an EOF */
  130. #define yywrap() 1
  131.  
  132. /* enter a start condition.  This macro really ought to take a parameter,
  133.  * but we do it the disgusting crufty way forced on us by the ()-less
  134.  * definition of BEGIN
  135.  */
  136. #define BEGIN yy_start = 1 + 2 *
  137.  
  138. /* action number for EOF rule of a given start state */
  139. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  140.  
  141. /* special action meaning "start processing a new file" */
  142. #define YY_NEW_FILE \
  143.     do \
  144.         { \
  145.         yy_init_buffer( yy_current_buffer, yyin ); \
  146.         yy_load_buffer_state(); \
  147.         } \
  148.     while ( 0 )
  149.  
  150. /* default declaration of generated scanner - a define so the user can
  151.  * easily add parameters
  152.  */
  153. #define YY_DECL int yylex YY_PROTO(( void )) 
  154.  
  155. /* code executed at the end of each rule */
  156. #define YY_BREAK break;
  157.  
  158. #define YY_END_OF_BUFFER_CHAR 0
  159.  
  160. #ifndef YY_BUF_SIZE
  161. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  162. #endif
  163.  
  164. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  165.  
  166. #define YY_CHAR char
  167. # line 1 "scanner.flex"
  168. #define INITIAL 0
  169. # line 2 "scanner.flex"
  170. static int lines=1,cols=1;
  171. # line 7 "scanner.flex"
  172.  
  173. /* done after the current pattern has been matched and before the
  174.  * corresponding action - sets up yytext
  175.  */
  176. #define YY_DO_BEFORE_ACTION \
  177.     yytext = yy_bp; \
  178.     yyleng = yy_cp - yy_bp; \
  179.     yy_hold_char = *yy_cp; \
  180.     *yy_cp = '\0'; \
  181.     yy_c_buf_p = yy_cp;
  182.  
  183. #define EOB_ACT_CONTINUE_SCAN 0
  184. #define EOB_ACT_END_OF_FILE 1
  185. #define EOB_ACT_LAST_MATCH 2
  186.  
  187. /* return all but the first 'n' matched characters back to the input stream */
  188. #define yyless(n) \
  189.     do \
  190.         { \
  191.         /* undo effects of setting up yytext */ \
  192.         *yy_cp = yy_hold_char; \
  193.         yy_c_buf_p = yy_cp = yy_bp + n; \
  194.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  195.         } \
  196.     while ( 0 )
  197.  
  198. #define unput(c) yyunput( c, yytext )
  199.  
  200.  
  201. struct yy_buffer_state
  202.     {
  203.     FILE *yy_input_file;
  204.  
  205.     YY_CHAR *yy_ch_buf;        /* input buffer */
  206.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  207.  
  208.     /* size of input buffer in bytes, not including room for EOB characters*/
  209.     int yy_buf_size;    
  210.  
  211.     /* number of characters read into yy_ch_buf, not including EOB characters */
  212.     int yy_n_chars;
  213.  
  214.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  215. #define EOF_NOT_SEEN 0
  216.     /* "pending" happens when the EOF has been seen but there's still
  217.      * some text process
  218.      */
  219. #define EOF_PENDING 1
  220. #define EOF_DONE 2
  221.     };
  222.  
  223. static YY_BUFFER_STATE yy_current_buffer;
  224.  
  225. /* we provide macros for accessing buffer states in case in the
  226.  * future we want to put the buffer states in a more general
  227.  * "scanner state"
  228.  */
  229. #define YY_CURRENT_BUFFER yy_current_buffer
  230.  
  231.  
  232. /* yy_hold_char holds the character lost when yytext is formed */
  233. static YY_CHAR yy_hold_char;
  234.  
  235. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  236.  
  237.  
  238.  
  239. #ifndef YY_USER_ACTION
  240. #define YY_USER_ACTION
  241. #endif
  242.  
  243. #ifndef YY_USER_INIT
  244. #define YY_USER_INIT
  245. #endif
  246.  
  247. extern YY_CHAR *yytext;
  248. extern int yyleng;
  249. extern FILE *yyin, *yyout;
  250.  
  251. YY_CHAR *yytext;
  252. int yyleng;
  253.  
  254. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  255.  
  256. #define YY_END_OF_BUFFER 12
  257. typedef int yy_state_type;
  258. static const short int yy_accept[16] =
  259.     {   0,
  260.         0,    0,   12,   10,    1,    6,    4,    3,    2,    5,
  261.         9,    7,    9,    8,    0
  262.     } ;
  263.  
  264. static const YY_CHAR yy_ec[128] =
  265.     {   0,
  266.         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
  267.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  268.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  269.         1,    1,    1,    1,    3,    1,    1,    1,    4,    1,
  270.         1,    5,    6,    1,    1,    7,    1,    8,    9,    9,
  271.         9,    9,    9,    9,    9,    9,    9,    1,    1,    1,
  272.         1,    1,    1,    1,    1,   10,    1,    1,    1,    1,
  273.        10,    1,    1,    1,   10,   10,    1,   10,    1,   10,
  274.         1,   10,   10,    1,    1,    1,    1,    1,    1,    1,
  275.         1,    1,    1,    1,    1,    1,   11,   11,   11,   11,
  276.  
  277.        11,   11,   11,   11,   11,    1,    1,    1,    1,    1,
  278.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  279.         1,    1,    1,    1,    1,    1,    1
  280.     } ;
  281.  
  282. static const YY_CHAR yy_meta[12] =
  283.     {   0,
  284.         1,    1,    1,    1,    1,    1,    1,    2,    2,    1,
  285.         2
  286.     } ;
  287.  
  288. static const short int yy_base[17] =
  289.     {   0,
  290.         0,    0,   15,   16,   16,   16,   16,   16,   16,   16,
  291.         3,   16,    2,   16,   16,   10
  292.     } ;
  293.  
  294. static const short int yy_def[17] =
  295.     {   0,
  296.        15,    1,   15,   15,   15,   15,   15,   15,   15,   15,
  297.        16,   15,   16,   15,    0,   15
  298.     } ;
  299.  
  300. static const short int yy_nxt[28] =
  301.     {   0,
  302.         4,    5,    6,    7,    8,    9,   10,    4,   11,   12,
  303.         4,   13,   15,   14,   15,    3,   15,   15,   15,   15,
  304.        15,   15,   15,   15,   15,   15,   15
  305.     } ;
  306.  
  307. static const short int yy_chk[28] =
  308.     {   0,
  309.         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  310.         1,   16,   13,   11,    3,   15,   15,   15,   15,   15,
  311.        15,   15,   15,   15,   15,   15,   15
  312.     } ;
  313.  
  314. static yy_state_type yy_last_accepting_state;
  315. static YY_CHAR *yy_last_accepting_cpos;
  316.  
  317. /* the intent behind this definition is that it'll catch
  318.  * any uses of REJECT which flex missed
  319.  */
  320. #define REJECT reject_used_but_not_detected
  321. #define yymore() yymore_used_but_not_detected
  322. #define YY_MORE_ADJ 0
  323.  
  324. /* these variables are all declared out here so that section 3 code can
  325.  * manipulate them
  326.  */
  327. /* points to current character in buffer */
  328. static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
  329. static int yy_init = 1;        /* whether we need to initialize */
  330. static int yy_start = 0;    /* start state number */
  331.  
  332. /* flag which is used to allow yywrap()'s to do buffer switches
  333.  * instead of setting up a fresh yyin.  A bit of a hack ...
  334.  */
  335. static int yy_did_buffer_switch_on_eof;
  336.  
  337. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  338. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  339. static int yy_get_next_buffer YY_PROTO(( void ));
  340. static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
  341. void yyrestart YY_PROTO(( FILE *input_file ));
  342. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  343. void yy_load_buffer_state YY_PROTO(( void ));
  344. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  345. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  346. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  347.  
  348. #define yy_new_buffer yy_create_buffer
  349.  
  350. #ifdef __cplusplus
  351. static int yyinput YY_PROTO(( void ));
  352. #else
  353. static int input YY_PROTO(( void ));
  354. #endif
  355.  
  356. YY_DECL
  357.     {
  358.     register yy_state_type yy_current_state;
  359.     register YY_CHAR *yy_cp, *yy_bp;
  360.     register int yy_act;
  361.  
  362.  
  363.  
  364.     if ( yy_init )
  365.     {
  366.     YY_USER_INIT;
  367.  
  368.     if ( ! yy_start )
  369.         yy_start = 1;    /* first start state */
  370.  
  371.     if ( ! yyin )
  372.         yyin = stdin;
  373.  
  374.     if ( ! yyout )
  375.         yyout = stdout;
  376.  
  377.     if ( yy_current_buffer )
  378.         yy_init_buffer( yy_current_buffer, yyin );
  379.     else
  380.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  381.  
  382.     yy_load_buffer_state();
  383.  
  384.     yy_init = 0;
  385.     }
  386.  
  387.     while ( 1 )        /* loops until end-of-file is reached */
  388.     {
  389.     yy_cp = yy_c_buf_p;
  390.  
  391.     /* support of yytext */
  392.     *yy_cp = yy_hold_char;
  393.  
  394.     /* yy_bp points to the position in yy_ch_buf of the start of the
  395.      * current run.
  396.      */
  397.     yy_bp = yy_cp;
  398.  
  399.     yy_current_state = yy_start;
  400. yy_match:
  401.     do
  402.         {
  403.         register YY_CHAR yy_c = yy_ec[*yy_cp];
  404.         if ( yy_accept[yy_current_state] )
  405.         {
  406.         yy_last_accepting_state = yy_current_state;
  407.         yy_last_accepting_cpos = yy_cp;
  408.         }
  409.         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  410.         {
  411.         yy_current_state = yy_def[yy_current_state];
  412.         if ( yy_current_state >= 16 )
  413.             yy_c = yy_meta[yy_c];
  414.         }
  415.         yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  416.         ++yy_cp;
  417.         }
  418.     while ( yy_current_state != 15 );
  419.     yy_cp = yy_last_accepting_cpos;
  420.     yy_current_state = yy_last_accepting_state;
  421.  
  422. yy_find_action:
  423.     yy_act = yy_accept[yy_current_state];
  424.  
  425.     YY_DO_BEFORE_ACTION;
  426.     YY_USER_ACTION;
  427.  
  428. do_action:    /* this label is used only to access EOF actions */
  429.  
  430.  
  431.     switch ( yy_act )
  432.         {
  433.         case 0: /* must backtrack */
  434.         /* undo the effects of YY_DO_BEFORE_ACTION */
  435.         *yy_cp = yy_hold_char;
  436.         yy_cp = yy_last_accepting_cpos;
  437.         yy_current_state = yy_last_accepting_state;
  438.         goto yy_find_action;
  439.  
  440. case 1:
  441. # line 8 "scanner.flex"
  442. { lines++; cols=1; }
  443.     YY_BREAK
  444. case 2:
  445. # line 9 "scanner.flex"
  446. { cols++;  return PROMOTE; }
  447.     YY_BREAK
  448. case 3:
  449. # line 10 "scanner.flex"
  450. { cols++;  return DROPS; }
  451.     YY_BREAK
  452. case 4:
  453. # line 11 "scanner.flex"
  454. { cols++;  return DROPS; }
  455.     YY_BREAK
  456. case 5:
  457. # line 12 "scanner.flex"
  458. { cols++;  return COLON; }
  459.     YY_BREAK
  460. case 6:
  461. # line 13 "scanner.flex"
  462. { cols++;  return CROSS; }
  463.     YY_BREAK
  464. case 7:
  465. # line 14 "scanner.flex"
  466. { yylval.string = yytext; cols+=strlen(yytext); return PIECE; }
  467.     YY_BREAK
  468. case 8:
  469. # line 15 "scanner.flex"
  470. { yylval.string = yytext; cols+=strlen(yytext); return SQUARE; }
  471.     YY_BREAK
  472. case 9:
  473. # line 16 "scanner.flex"
  474. { yylval.string = yytext; cols+=strlen(yytext); return NUMBER; }
  475.     YY_BREAK
  476. case 10:
  477. # line 17 "scanner.flex"
  478. { cols++; }
  479.     YY_BREAK
  480. case 11:
  481. # line 18 "scanner.flex"
  482. ECHO;
  483.     YY_BREAK
  484. case YY_STATE_EOF(INITIAL):
  485.     yyterminate();
  486.  
  487.         case YY_END_OF_BUFFER:
  488.         {
  489.         /* amount of text matched not including the EOB char */
  490.         int yy_amount_of_matched_text = yy_cp - yytext - 1;
  491.  
  492.         /* undo the effects of YY_DO_BEFORE_ACTION */
  493.         *yy_cp = yy_hold_char;
  494.  
  495.         /* note that here we test for yy_c_buf_p "<=" to the position
  496.          * of the first EOB in the buffer, since yy_c_buf_p will
  497.          * already have been incremented past the NUL character
  498.          * (since all states make transitions on EOB to the end-
  499.          * of-buffer state).  Contrast this with the test in yyinput().
  500.          */
  501.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  502.             /* this was really a NUL */
  503.             {
  504.             yy_state_type yy_next_state;
  505.  
  506.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  507.  
  508.             yy_current_state = yy_get_previous_state();
  509.  
  510.             /* okay, we're now positioned to make the
  511.              * NUL transition.  We couldn't have
  512.              * yy_get_previous_state() go ahead and do it
  513.              * for us because it doesn't know how to deal
  514.              * with the possibility of jamming (and we
  515.              * don't want to build jamming into it because
  516.              * then it will run more slowly)
  517.              */
  518.  
  519.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  520.  
  521.             yy_bp = yytext + YY_MORE_ADJ;
  522.  
  523.             if ( yy_next_state )
  524.             {
  525.             /* consume the NUL */
  526.             yy_cp = ++yy_c_buf_p;
  527.             yy_current_state = yy_next_state;
  528.             goto yy_match;
  529.             }
  530.  
  531.             else
  532.             {
  533.                 yy_cp = yy_last_accepting_cpos;
  534.                 yy_current_state = yy_last_accepting_state;
  535.             goto yy_find_action;
  536.             }
  537.             }
  538.  
  539.         else switch ( yy_get_next_buffer() )
  540.             {
  541.             case EOB_ACT_END_OF_FILE:
  542.             {
  543.             yy_did_buffer_switch_on_eof = 0;
  544.  
  545.             if ( yywrap() )
  546.                 {
  547.                 /* note: because we've taken care in
  548.                  * yy_get_next_buffer() to have set up yytext,
  549.                  * we can now set up yy_c_buf_p so that if some
  550.                  * total hoser (like flex itself) wants
  551.                  * to call the scanner after we return the
  552.                  * YY_NULL, it'll still work - another YY_NULL
  553.                  * will get returned.
  554.                  */
  555.                 yy_c_buf_p = yytext + YY_MORE_ADJ;
  556.  
  557.                 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
  558.                 goto do_action;
  559.                 }
  560.  
  561.             else
  562.                 {
  563.                 if ( ! yy_did_buffer_switch_on_eof )
  564.                 YY_NEW_FILE;
  565.                 }
  566.             }
  567.             break;
  568.  
  569.             case EOB_ACT_CONTINUE_SCAN:
  570.             yy_c_buf_p = yytext + yy_amount_of_matched_text;
  571.  
  572.             yy_current_state = yy_get_previous_state();
  573.  
  574.             yy_cp = yy_c_buf_p;
  575.             yy_bp = yytext + YY_MORE_ADJ;
  576.             goto yy_match;
  577.  
  578.             case EOB_ACT_LAST_MATCH:
  579.             yy_c_buf_p =
  580.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  581.  
  582.             yy_current_state = yy_get_previous_state();
  583.  
  584.             yy_cp = yy_c_buf_p;
  585.             yy_bp = yytext + YY_MORE_ADJ;
  586.             goto yy_find_action;
  587.             }
  588.         break;
  589.         }
  590.  
  591.         default:
  592. #ifdef FLEX_DEBUG
  593.         printf( "action # %d\n", yy_act );
  594. #endif
  595.         YY_FATAL_ERROR(
  596.             "fatal flex scanner internal error--no action found" );
  597.         }
  598.     }
  599.     }
  600.  
  601.  
  602. /* yy_get_next_buffer - try to read in a new buffer
  603.  *
  604.  * synopsis
  605.  *     int yy_get_next_buffer();
  606.  *     
  607.  * returns a code representing an action
  608.  *     EOB_ACT_LAST_MATCH - 
  609.  *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  610.  *     EOB_ACT_END_OF_FILE - end of file
  611.  */
  612.  
  613. static int yy_get_next_buffer()
  614.  
  615.     {
  616.     register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
  617.     register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
  618.     register int number_to_move, i;
  619.     int ret_val;
  620.  
  621.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  622.     YY_FATAL_ERROR(
  623.         "fatal flex scanner internal error--end of buffer missed" );
  624.  
  625.     /* try to read more data */
  626.  
  627.     /* first move last chars to start of buffer */
  628.     number_to_move = yy_c_buf_p - yytext;
  629.  
  630.     for ( i = 0; i < number_to_move; ++i )
  631.     *(dest++) = *(source++);
  632.  
  633.     if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
  634.     /* don't do the read, it's not guaranteed to return an EOF,
  635.      * just force an EOF
  636.      */
  637.     yy_n_chars = 0;
  638.  
  639.     else
  640.     {
  641.     int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
  642.  
  643.     if ( num_to_read > YY_READ_BUF_SIZE )
  644.         num_to_read = YY_READ_BUF_SIZE;
  645.  
  646.     else if ( num_to_read <= 0 )
  647.         YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
  648.  
  649.     /* read in more data */
  650.     YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  651.           yy_n_chars, num_to_read );
  652.     }
  653.  
  654.     if ( yy_n_chars == 0 )
  655.     {
  656.     if ( number_to_move == 1 )
  657.         {
  658.         ret_val = EOB_ACT_END_OF_FILE;
  659.         yy_current_buffer->yy_eof_status = EOF_DONE;
  660.         }
  661.  
  662.     else
  663.         {
  664.         ret_val = EOB_ACT_LAST_MATCH;
  665.         yy_current_buffer->yy_eof_status = EOF_PENDING;
  666.         }
  667.     }
  668.  
  669.     else
  670.     ret_val = EOB_ACT_CONTINUE_SCAN;
  671.  
  672.     yy_n_chars += number_to_move;
  673.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  674.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  675.  
  676.     /* yytext begins at the second character in yy_ch_buf; the first
  677.      * character is the one which preceded it before reading in the latest
  678.      * buffer; it needs to be kept around in case it's a newline, so
  679.      * yy_get_previous_state() will have with '^' rules active
  680.      */
  681.  
  682.     yytext = &yy_current_buffer->yy_ch_buf[1];
  683.  
  684.     return ( ret_val );
  685.     }
  686.  
  687.  
  688. /* yy_get_previous_state - get the state just before the EOB char was reached
  689.  *
  690.  * synopsis
  691.  *     yy_state_type yy_get_previous_state();
  692.  */
  693.  
  694. static yy_state_type yy_get_previous_state()
  695.  
  696.     {
  697.     register yy_state_type yy_current_state;
  698.     register YY_CHAR *yy_cp;
  699.  
  700.     yy_current_state = yy_start;
  701.  
  702.     for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  703.     {
  704.     register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
  705.     if ( yy_accept[yy_current_state] )
  706.         {
  707.         yy_last_accepting_state = yy_current_state;
  708.         yy_last_accepting_cpos = yy_cp;
  709.         }
  710.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  711.         {
  712.         yy_current_state = yy_def[yy_current_state];
  713.         if ( yy_current_state >= 16 )
  714.         yy_c = yy_meta[yy_c];
  715.         }
  716.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  717.     }
  718.  
  719.     return ( yy_current_state );
  720.     }
  721.  
  722.  
  723. /* yy_try_NUL_trans - try to make a transition on the NUL character
  724.  *
  725.  * synopsis
  726.  *     next_state = yy_try_NUL_trans( current_state );
  727.  */
  728.  
  729. #ifdef YY_USE_PROTOS
  730. static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
  731. #else
  732. static yy_state_type yy_try_NUL_trans( yy_current_state )
  733. register yy_state_type yy_current_state;
  734. #endif
  735.  
  736.     {
  737.     register int yy_is_jam;
  738.     register YY_CHAR *yy_cp = yy_c_buf_p;
  739.  
  740.     register YY_CHAR yy_c = 1;
  741.     if ( yy_accept[yy_current_state] )
  742.     {
  743.     yy_last_accepting_state = yy_current_state;
  744.     yy_last_accepting_cpos = yy_cp;
  745.     }
  746.     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  747.     {
  748.     yy_current_state = yy_def[yy_current_state];
  749.     if ( yy_current_state >= 16 )
  750.         yy_c = yy_meta[yy_c];
  751.     }
  752.     yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
  753.     yy_is_jam = (yy_current_state == 15);
  754.  
  755.     return ( yy_is_jam ? 0 : yy_current_state );
  756.     }
  757.  
  758.  
  759. #ifdef YY_USE_PROTOS
  760. static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
  761. #else
  762. static void yyunput( c, yy_bp )
  763. YY_CHAR c;
  764. register YY_CHAR *yy_bp;
  765. #endif
  766.  
  767.     {
  768.     register YY_CHAR *yy_cp = yy_c_buf_p;
  769.  
  770.     /* undo effects of setting up yytext */
  771.     *yy_cp = yy_hold_char;
  772.  
  773.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  774.     { /* need to shift things up to make room */
  775.     register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
  776.     register YY_CHAR *dest =
  777.         &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
  778.     register YY_CHAR *source =
  779.         &yy_current_buffer->yy_ch_buf[number_to_move];
  780.  
  781.     while ( source > yy_current_buffer->yy_ch_buf )
  782.         *--dest = *--source;
  783.  
  784.     yy_cp += dest - source;
  785.     yy_bp += dest - source;
  786.     yy_n_chars = yy_current_buffer->yy_buf_size;
  787.  
  788.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  789.         YY_FATAL_ERROR( "flex scanner push-back overflow" );
  790.     }
  791.  
  792.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  793.     yy_cp[-2] = '\n';
  794.  
  795.     *--yy_cp = c;
  796.  
  797.     /* note: the formal parameter *must* be called "yy_bp" for this
  798.      *       macro to now work correctly
  799.      */
  800.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  801.     }
  802.  
  803.  
  804. #ifdef __cplusplus
  805. static int yyinput()
  806. #else
  807. static int input()
  808. #endif
  809.  
  810.     {
  811.     int c;
  812.     YY_CHAR *yy_cp = yy_c_buf_p;
  813.  
  814.     *yy_cp = yy_hold_char;
  815.  
  816.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  817.     {
  818.     /* yy_c_buf_p now points to the character we want to return.
  819.      * If this occurs *before* the EOB characters, then it's a
  820.      * valid NUL; if not, then we've hit the end of the buffer.
  821.      */
  822.     if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  823.         /* this was really a NUL */
  824.         *yy_c_buf_p = '\0';
  825.  
  826.     else
  827.         { /* need more input */
  828.         yytext = yy_c_buf_p;
  829.         ++yy_c_buf_p;
  830.  
  831.         switch ( yy_get_next_buffer() )
  832.         {
  833.         case EOB_ACT_END_OF_FILE:
  834.             {
  835.             if ( yywrap() )
  836.             {
  837.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  838.             return ( EOF );
  839.             }
  840.  
  841.             YY_NEW_FILE;
  842.  
  843. #ifdef __cplusplus
  844.             return ( yyinput() );
  845. #else
  846.             return ( input() );
  847. #endif
  848.             }
  849.             break;
  850.  
  851.         case EOB_ACT_CONTINUE_SCAN:
  852.             yy_c_buf_p = yytext + YY_MORE_ADJ;
  853.             break;
  854.  
  855.         case EOB_ACT_LAST_MATCH:
  856. #ifdef __cplusplus
  857.             YY_FATAL_ERROR( "unexpected last match in yyinput()" );
  858. #else
  859.             YY_FATAL_ERROR( "unexpected last match in input()" );
  860. #endif
  861.         }
  862.         }
  863.     }
  864.  
  865.     c = *yy_c_buf_p;
  866.     yy_hold_char = *++yy_c_buf_p;
  867.  
  868.     return ( c );
  869.     }
  870.  
  871.  
  872. #ifdef YY_USE_PROTOS
  873. void yyrestart( FILE *input_file )
  874. #else
  875. void yyrestart( input_file )
  876. FILE *input_file;
  877. #endif
  878.  
  879.     {
  880.     yy_init_buffer( yy_current_buffer, input_file );
  881.     yy_load_buffer_state();
  882.     }
  883.  
  884.  
  885. #ifdef YY_USE_PROTOS
  886. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  887. #else
  888. void yy_switch_to_buffer( new_buffer )
  889. YY_BUFFER_STATE new_buffer;
  890. #endif
  891.  
  892.     {
  893.     if ( yy_current_buffer == new_buffer )
  894.     return;
  895.  
  896.     if ( yy_current_buffer )
  897.     {
  898.     /* flush out information for old buffer */
  899.     *yy_c_buf_p = yy_hold_char;
  900.     yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  901.     yy_current_buffer->yy_n_chars = yy_n_chars;
  902.     }
  903.  
  904.     yy_current_buffer = new_buffer;
  905.     yy_load_buffer_state();
  906.  
  907.     /* we don't actually know whether we did this switch during
  908.      * EOF (yywrap()) processing, but the only time this flag
  909.      * is looked at is after yywrap() is called, so it's safe
  910.      * to go ahead and always set it.
  911.      */
  912.     yy_did_buffer_switch_on_eof = 1;
  913.     }
  914.  
  915.  
  916. #ifdef YY_USE_PROTOS
  917. void yy_load_buffer_state( void )
  918. #else
  919. void yy_load_buffer_state()
  920. #endif
  921.  
  922.     {
  923.     yy_n_chars = yy_current_buffer->yy_n_chars;
  924.     yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  925.     yyin = yy_current_buffer->yy_input_file;
  926.     yy_hold_char = *yy_c_buf_p;
  927.     }
  928.  
  929.  
  930. #ifdef YY_USE_PROTOS
  931. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  932. #else
  933. YY_BUFFER_STATE yy_create_buffer( file, size )
  934. FILE *file;
  935. int size;
  936. #endif
  937.  
  938.     {
  939.     YY_BUFFER_STATE b;
  940.  
  941.     b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
  942.  
  943.     if ( ! b )
  944.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  945.  
  946.     b->yy_buf_size = size;
  947.  
  948.     /* yy_ch_buf has to be 2 characters longer than the size given because
  949.      * we need to put in 2 end-of-buffer characters.
  950.      */
  951.     b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
  952.  
  953.     if ( ! b->yy_ch_buf )
  954.     YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  955.  
  956.     yy_init_buffer( b, file );
  957.  
  958.     return ( b );
  959.     }
  960.  
  961.  
  962. #ifdef YY_USE_PROTOS
  963. void yy_delete_buffer( YY_BUFFER_STATE b )
  964. #else
  965. void yy_delete_buffer( b )
  966. YY_BUFFER_STATE b;
  967. #endif
  968.  
  969.     {
  970.     if ( b == yy_current_buffer )
  971.     yy_current_buffer = (YY_BUFFER_STATE) 0;
  972.  
  973.     free( (char *) b->yy_ch_buf );
  974.     free( (char *) b );
  975.     }
  976.  
  977.  
  978. #ifdef YY_USE_PROTOS
  979. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  980. #else
  981. void yy_init_buffer( b, file )
  982. YY_BUFFER_STATE b;
  983. FILE *file;
  984. #endif
  985.  
  986.     {
  987.     b->yy_input_file = file;
  988.  
  989.     /* we put in the '\n' and start reading from [1] so that an
  990.      * initial match-at-newline will be true.
  991.      */
  992.  
  993.     b->yy_ch_buf[0] = '\n';
  994.     b->yy_n_chars = 1;
  995.  
  996.     /* we always need two end-of-buffer characters.  The first causes
  997.      * a transition to the end-of-buffer state.  The second causes
  998.      * a jam in that state.
  999.      */
  1000.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1001.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  1002.  
  1003.     b->yy_buf_pos = &b->yy_ch_buf[1];
  1004.  
  1005.     b->yy_eof_status = EOF_NOT_SEEN;
  1006.     }
  1007. # line 18 "scanner.flex"
  1008.  
  1009.  
  1010.  
  1011.  
  1012.